package edu.towson.cosc603.coffeemaker;
import org.junit.Test;

import junit.framework.TestCase;

public class InventoryTest extends TestCase{
	private CoffeeMaker cm;
	private Inventory i;
	private Recipe r1;
	private Recipe r2;

	public void setUp() throws Exception {
		cm = new CoffeeMaker();
		i = cm.checkInventory();

		r1 = new Recipe();
		r1.setName("Coffee");
		r1.setPrice(50);
		r1.setAmtCoffee(3);
		r1.setAmtMilk(1);
		r1.setAmtSugar(1);
		r1.setAmtChocolate(0);
		cm.addRecipe(r1);
		
		r2 = new Recipe();
		r2.setName("ChocolateMilk");
		r2.setPrice(75);
		r2.setAmtCoffee(0);
		r2.setAmtMilk(5);
		r2.setAmtSugar(3);
		r2.setAmtChocolate(5);
		cm.addRecipe(r2);
	}
		
	@Test
	public void testInventory()
	{
		assertEquals(i.getChocolate(),15);
		assertEquals(i.getCoffee(),15);
		assertEquals(i.getMilk(),15);
		assertEquals(i.getSugar(),15);
	}
		

	@Test
	public void testSetCoffee() 
	{
		i.setCoffee(5);
		assertEquals(i.getCoffee(),5);
	}

	@Test
	public void testSetMilk1() 
	{
		i.setMilk(-1);
		assertEquals(i.getMilk(),0);
	}

	@Test
	public void testSetSugar1()
	{
		i.setSugar(-1);
		assertEquals(i.getSugar(),0);
	}

	@Test
	public void testEnoughIngredients1()
	{
		assertEquals(15,i.getMilk());
		assertTrue(i.enoughIngredients(r1));	
	}
	
	@Test
	public void testEnoughIngredients2()
	{

		assertEquals(15,i.getChocolate());
		assertTrue(i.enoughIngredients(r1));	
	}
	
	@Test
	public void testEnoughIngredients3()
	{

		assertEquals(15,i.getCoffee());
		assertTrue(i.enoughIngredients(r1));	
	}
	
	@Test
	public void testEnoughIngredients4()
	{

		assertEquals(15,i.getSugar());
		assertTrue(i.enoughIngredients(r1));	
	}
	
	
}

